import com.bit.demo.UserService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class App2 {
    public static void main(String[] args) {
        //1.得到上下文对象
        BeanFactory context = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        //2.获取bean对象
        UserService userService = (UserService) context.getBean("user");
        //3.使用bean对象
         userService.sayHi();
    }
}
